using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ChangeTextureEffectComponent : TakeDamageEffectBaseComponent
{
    public List<Renderer> renderers;

    public Texture InitTexture;
    public Texture TakeDamageTexture;

    public override void TakeDamageEffectPlay(GameObject AttackObject)
    {
        base.TakeDamageEffectPlay(AttackObject);
        if (renderers.Count == 0)
        {
            return;
        }
        for (int i = 0; i < renderers.Count; i++)
        {
            if (renderers[i].materials[0].HasProperty("_BaseMap"))
            {
                renderers[i].materials[0].SetTexture("_BaseMap", TakeDamageTexture);
            }
            else
            {
                renderers[i].materials[0].SetTexture("_MainTex", TakeDamageTexture);
            }
        }
        // StartCoroutine(ResetTexture());
    }
}
